<?php
class dept extends model{

	public function checkdeptcodeexist($deptcode){
		$sql="select * from department where departmentcode='{$deptcode}'";
		$res=$this->db->query($sql);
		return $res->num_rows;
	}

	public function insertdept(){
		$sql="insert into department(departmentcode,name,created_date,active_yn) values('{$this->db->escape($_POST["deptcode"])}',".
			"'{$this->db->escape($_POST["deptname"])}',NOW(),'Y')";
		$this->db->query($sql);
	}
	
	public function loaddepartment(){
		$sql="select * from department where active_yn='Y'";
		return $this->db->query($sql);
	}

}